package com.example.erp.controller;


import com.alibaba.fastjson.JSONObject;
import com.example.erp.entity.dto.InoutBoundDto;
import com.example.erp.mapper.InoutBoundDtlMapper;
import com.example.erp.service.IInoutBoundDtlService;
import com.example.erp.service.IInoutBoundService;
import com.example.erp.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 出入库母单 前端控制器
 * </p>
 *
 * @author rws
 * @since 2025-01-08
 */
@RestController
@RequestMapping("/erp/inout-bound")
@CrossOrigin
public class InoutBoundController {
    @Autowired
    private IInoutBoundService iInoutBoundService;
    @Autowired
    private IInoutBoundDtlService iInoutBoundDtlService;

    @RequestMapping("/get-in-bound")
    public JSONObject getInBound(){
        List<InoutBoundDto>inoutBoundDtoList=iInoutBoundService.selectInBound();
        return JsonResult.successJson(inoutBoundDtoList);
    }

    @RequestMapping("/get-out-bound")
    public JSONObject getOutBound(){
        List<InoutBoundDto>inoutBoundDtoList=iInoutBoundService.selectOutBound();
        return JsonResult.successJson(inoutBoundDtoList);
    }

    @RequestMapping("/update-bound")
    public JSONObject updateBound(@RequestBody InoutBoundDto inoutBoundDto){
        iInoutBoundService.updateBound(inoutBoundDto);
        return JsonResult.successJson();
    }

    @RequestMapping("/out-store")
    public JSONObject outStore(@RequestBody InoutBoundDto inoutBoundDto){
        iInoutBoundDtlService.outStore(inoutBoundDto);
        return JsonResult.successJson();
    }
}

